'''用Rar备份笔记的脚本,更简单实用.但只能读取文件路径能用gbk解码的情况.'''

import sys
import subprocess

import FileFilter

## 参数设定,时间格式为"%Y-%m-%d %H:%M:%S";Rar应用程序位置设定
#BACKUP_DIR = r'D:\MyDocument\MyNote'
BACKUP_DIR = r'F:\Music\_MusicBackup'
#START_TIME = '2019-6-9 22:49:01' # note
START_TIME = '1990-1-1 22:49:01'
#END_TIME = '2019-7-7 15:00:00' # note
END_TIME = '2019-8-11 15:00:00'
## Rar应用程序位置设定,备份的rar文件设定
RAR_EXE = r'C:\Program Files\WinRAR\WinRAR.exe'
BACKUP_FILE = sys.path[0]+r'\_MusicBackup_till20190811.rar'
#BACKUP_FILE = sys.path[0]+r'\MyVedioBackup_until190811.rar'

## 选择备份文件,生成备份资料
ff = FileFilter.FileFilter(BACKUP_DIR, START_TIME, END_TIME)
ff.main()

## 启用rar命令备份
orderList = [RAR_EXE, 'a', '-rr3%', BACKUP_FILE,
  r'@{}\logFiles.txt'.format(sys.path[0])]
subprocess.call(orderList)